<?php

namespace Biz\model\brand;

/**
 *
 * @author huining
 *
 */
class ShopCity extends \Doraemon\pockets\datebase\BaseDbModel
{

    const _CONFIG_FILE_ = 'db_store';

    const _CONFIG_SELECT_ = 'db_store';

    const _DATABASE_ = 'store';

    const _TABLE_NAME = 'brand_shop_city';

    const STATUS_NORMAL = 1;

    const STATUS_DELETE = 9;


    //添加城市信息
    public static function addCityInfo($data)
    {
        return self::insert($data)->rowcount();

    }

    //根据店铺id信息获取信息
    public static function getCityByBrandId($brand_id)
    {
        $map  = [] ;
        $map['AND']=[
            'brand_id' => $brand_id ,
            'city_status' => self::STATUS_NORMAL
        ];
        $map['ORDER'] =['city_sort' => 'DESC'];
        return self::select("*",$map);
    }

    //更新
    public static function updateById($id , $data)
    {
        return self::update($data ,[
            'id' => $id
        ])->rowCount();
    }

    //根据条件更新
    public static function updateByWhere($where , $data)
    {
        return self::update($data , $where)->rowCount();

    }

    //获取数据
    public static  function getDataBywhere($where)
    {
        return self::select('*',$where);

    }

}

